package com.linkgie.galaxyframework.metadata.structure;

import javax.validation.constraints.NotBlank;

import com.linkgie.galaxyframework.metadata.DataEntity;
import com.linkgie.galaxyframework.metadata.DataField;
import com.linkgie.galaxyframework.metadata.DataInterface;
import com.linkgie.galaxyframework.metadata.DataKey;
import com.linkgie.galaxyframework.metadata.DataLabel;
import com.linkgie.galaxyframework.metadata.DataType;
import com.linkgie.galaxyframework.metadata.DefaultBoolean;

@DataInterface
@DataEntity
public class DataInterfaceMetadata implements DataTypeInfo{

	/**
	 * 数据接口的唯一名称；
	 * 
	 * 具有全局唯一性；
	 */
	@NotBlank
	@DataKey
	@DataField(name = "类名", order = 0, modifiable = false)
	private String name;

	/**
	 * 标题名称，作为描述性的名称；
	 */
	@NotBlank
	@DataLabel
	@DataField(name = "标签名", order = 1)
	private String topic;
	
	/**
	 * 描述；
	 */
	@DataType(contentType = "plain;multiline=true")
	@DataField(name = "描述", order = 3)
	private String description;
	
	/**
	 * 是否为虚构的接口；
	 * <p>
	 * 虚构的接口是指 {@link DataModelMetadata#isInterfaced()} 为 true 时生成的接口；<p>
	 * 虚构的接口在运行时仅仅是个描述符，并不会映射生成对应语言的接口；
	 * 
	 * <p>
	 * 此属性不应该被直接编辑，而是由上下文维护；
	 */
	@DefaultBoolean(false)
	@DataType(contentType = "enum;strict=true;true='是';false='否'")
	@DataField(name = "虚接口", order = 4, readonly = true)
	private boolean virtual;

	@DataField(name = "字段列表", order = 20)
	private FieldMetadata[] fields;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public FieldMetadata[] getFields() {
		return fields;
	}

	public void setFields(FieldMetadata[] fields) {
		this.fields = fields;
	}

	public String getTopic() {
		return topic;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public boolean isVirtual() {
		return virtual;
	}

	public void setVirtual(boolean unreal) {
		this.virtual = unreal;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

}
